package com.applet.shoppingcart.mapper;

import com.applet.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 购物车 mapper
 */
@Mapper
public interface ShoppingCartMapper {


    /**
     * 根据用户id和菜品id 查询购物车
     */
    ShoppingCart selectUserShopCart(ShoppingCart shoppingCart);


    /**
     * 新增购物车数据 用户的 菜品/套餐
     */
    Integer insert(ShoppingCart newShoppingCart);


    /**
     * 根据id 修改用户购物车数据
     */
    Integer updateUserShopCatById(ShoppingCart shoppingCart);


    /**
     * 根据userId 查询用户购物车
     */
    List<ShoppingCart> selectUserShopCartListByUserId(@Param("userId") Long userId);


    /**
     * 根据userId 清空用户购物车
     */
    Integer deleteUserShopCartByUserId(@Param("userId") Long userId);


    /**
     * 条件删除用户购物车单个数据
     */
    Integer deleteUserShopCart(ShoppingCart shoppingCart);
}
